﻿@model Webcar.Entitys.bs_car_runrecord

@{ Layout = "~/Views/Shared/_leftPanelLayout.cshtml";}
@section LeftTree
{
    @{
        Html.RenderPartial("DeptTreePartialView", new Webcar.Models.DeptTreeMode { Action = "RunRecordList", Controller = "Table", ShowChild = false });
     }
}
<div style="margin:5px 5px 5px 5px">
@using (Html.BeginForm("RunRecordEdit", "Table", Html.ViewContext.RouteData.Values,FormMethod.Post))
{
    @Html.AntiForgeryToken()
    <div id="edit-car" style="width:700px">
    @Html.HiddenFor(a => a.xh)
    @Html.HiddenFor(a => a.car_no)

        <table class="edit-table">
            <tr>
                <td style="width: 80px; text-align: right;">*所属单位：</td>
                <td>@Html.DropDownListFor(a => a.dept_code, WebcarDataHelper.UserSuperDeptList, new { @style = "width: 100%;", @onchange = "changeDept();" })</td>
                <td style="width: 80px; text-align: right">*牌照号：</td>
                <td style="width: 200px">@Html.TextBox("RECORD_NO",(string)@ViewBag.RecordNo)</td>
            </tr>

            <tr>
                <td style="width: 80px; text-align: right">*驾驶员：</td>
                <td style="width: 200px">@Html.TextBoxFor(a => a.driver_name)</td>
                <td style="width: 80px; text-align: right">*证明人：</td>
                <td style="width: 200px">@Html.TextBoxFor(a=>a.cetify_man)</td>
            </tr>
            
            <tr>
                <td style="width: 80px; text-align: right">上次运行时间：</td>
                <td style="width: 200px">@Html.CalendarFor(a => a.last_date)</td>
                <td style="width: 80px; text-align: right">上次运行地点：</td>
                <td style="width: 200px">@Html.TextBoxFor(a=>a.last_place)</td>
            </tr>
            <tr>
                <td style="width: 80px; text-align: right">*本次运行时间：</td>
                <td style="width: 200px">@Html.CalendarFor(a => a.run_date)</td>
                <td style="width: 80px; text-align: right">*本次运行地点：</td>
                <td style="width: 200px">@Html.TextBoxFor(a=>a.run_place)</td>
            </tr>
            <tr>
                <td style="width: 80px; text-align: right;">底盘检查情况：</td>
                <td colspan="3">@Html.TextAreaFor(a => a.dp,4,30,new { @style = "width: 100%;" })</td>
            </tr>
            <tr>
                <td style="width: 80px; text-align: right;">上车检查情况：</td>
                <td colspan="3">@Html.TextAreaFor(a => a.sc,4,30,new { @style = "width: 100%;" })</td>
            </tr>
            <tr>
                <td style="width: 80px; text-align: right;">液压检查情况：</td>
                <td colspan="3">@Html.TextAreaFor(a => a.yy,4,30,new { @style = "width: 100%;" })</td>
            </tr>
            <tr>
                <td style="width: 80px; text-align: right;">电气检查情况：</td>
                <td colspan="3">@Html.TextAreaFor(a => a.dq,4,30,new { @style = "width: 100%;" })</td>
            </tr>
            <tr>
                <td style="width: 80px; text-align: right;">备注：</td>
                <td colspan="3">@Html.TextAreaFor(a => a.qt,4,30,new { @style = "width: 100%;" })</td>
            </tr>

        </table>
        <br />
        <div class="validation-errors">@ViewBag.ErrorMessage</div>
    </div>
    <table style="width:700px">
        <tr>
            <td style="width:650px"></td>
            <td>
                @Html.DevExpress().Button(settings =>
                {
                    settings.Name = "Button1";
                    settings.Text = CurrentUser.CheckPermission(PermissionManager.填写无功运行记录) ? "保存" : "无权限";
                    settings.Enabled = CurrentUser.CheckPermission(PermissionManager.填写无功运行记录);
                    settings.UseSubmitBehavior = true;
                    settings.Width = 70;
                    settings.ControlStyle.CssClass = "button1";
                }).GetHtml()

            </td>
            <td>
                @Html.DevExpress().Button(settings =>
                {
                    settings.ControlStyle.CssClass = "button2";
                    settings.Name = "Button2";
                    settings.Text = "取消";
                    settings.Width = 70;
                    settings.ClientSideEvents.Click = "function(s, e){history.back(); }";
                }).GetHtml()
            </td>
        </tr>

    </table>
}
</div>            
<script type="text/javascript">

    changeDept();
    
    $("#RECORD_NO").change(function () {
        $("#car_no").val("");
    });
    function changeDept() {
        setCarAutoComplete("RECORD_NO", $("#dept_code").val(),
            '@Url.Action("GetAutoCompleteCar","Common")',
            function (event, ui) {
                $("#car_no").val(ui.item.key);
            }
        );
        setDriverAutoComplete("driver_name", $("#dept_code").val(), '@Url.Action("GetAutoCompleteDriver","Common")',
        function (event, ui) {
            $("#driver_name").val(ui.item.value);
        });
        };

</script>    